home *** CD-ROM | disk | FTP | other *** search
- /*
- * Touch: Unix-like touch command which either
- * 1) Sets the date-stamp of all selected entries in source listers
- * to the current date and time, or
- * 2) creates a new (empty) file if no entries are selected. User
- * is prompted via requester.
- *
- * Call: ARexx DOpus5:ARexx/Touch.dopus5 {Qp}
- *
- * Touch.dopus5 v1.0
- * By David Lübbren, 1.7.96
- * EMail: uhay@rz.uni-karlsruhe.de
- */
-
-
- PARSE ARG dopusport
-
- IF dopusport ~= "" THEN ADDRESS VALUE dopusport
- ELSE DO
- SAY "DOpus5 is NOT running !"
- EXIT
- END
-
- OPTIONS RESULTS
-
- lister query source
- IF rc > 0 THEN DO
- Beep
- EXIT
- END
-
- PARSE VAR result handle .
-
-
- lister set handle busy on
-
- lister query handle path
- IF rc = 0 THEN DO
- SourcePath = STRIP(result, 'B', '"')
- lister query handle selentries stem Entry.
- IF rc = 0 THEN DO
- IF Entry.count > 0 THEN DO
- lister set handle progress Entry.count 'Touching...'
- lister set handle title 'Touching...'
- lister refresh handle full
-
- DO i=0 TO Entry.count-1
- lister query handle abort
- IF result THEN
- SIGNAL quitit
-
- lister set handle progress count i+1
- lister set handle progress name Entry.i
-
- ADDRESS COMMAND 'SetDate ' || '"' || SourcePath || Entry.i || '"'
-
- lister select handle '"' || Entry.i || '"' off
- lister refresh handle
- END
- END
- ELSE DO
- DO UNTIL again = 0
- again = 0
- dopus getstring '"Filename to create:" 255 "" Ok|Cancel'
- IF dopusrc ~= 0 THEN DO
- name = STRIP(result, 'B', '"')
- divpos = MAX(LASTPOS(':', name),LASTPOS('/', name))
- IF divpos > 0 THEN name = SUBSTR(name, divpos + 1)
- FullName = SourcePath || name
- lister query handle entry '"'name'"'
- IF rc = 0 THEN DO
- dopus request '"Error: '''name''' already exists" Again|Cancel'
- again = rc
- END
- ELSE DO
- IF OPEN('fp', FullName, 'w') THEN DO
- CLOSE('fp')
- lister set handle busy off
- lister read handle '"'SourcePath'"' force
- lister wait handle
- lister set handle busy on
- lister select handle '"'name'"' on
- IF rc ~= 0 THEN DO
- dopus request '"Konnte '''name''' nicht selectieren" Ok'
- END
- again = 0
- END
- ELSE DO
- dopus request '"Error: Could not open '''FullName'''" Again|Cancel'
- again = rc
- END
- END
- END
- END
- END
- END
- END
-
- SIGNAL quitit
-
-
- quitit:
-
- lister set handle title
- lister refresh handle full
- lister set handle busy off
- EXIT
-